package com.zego.wawaji.wawaji_client.util;

import com.noble.library.basic.sp.PSP;

/**
 * 存储Zego初始化用户数据
 */
public class PreferenceUtil {
    private static final String PREFERENCE_KEY_USER_ID = "PREFERENCE_KEY_USER_ID";
    private static final String PREFERENCE_KEY_USER_NAME = "PREFERENCE_KEY_USER_NAME";

    private static PreferenceUtil sInstance;

    public static PreferenceUtil getInstance() {
        if (sInstance == null) {
            synchronized (PreferenceUtil.class) {
                if (sInstance == null) {
                    sInstance = new PreferenceUtil();
                }
            }
        }
        return sInstance;
    }

    public void setUserID(String userID) {
        PSP.getInstance().put(PREFERENCE_KEY_USER_ID, userID);
    }

    public String getUserID() {
        return PSP.getInstance().getString(PREFERENCE_KEY_USER_ID, "");
    }

    public void setUserName(String userName) {
        PSP.getInstance().put(PREFERENCE_KEY_USER_NAME, userName);
    }

    public String getUserName() {
        return PSP.getInstance().getString(PREFERENCE_KEY_USER_NAME, "");
    }
}
